<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form method="post" th:action="@{/books}">
    图书名称：<input type="text" th:value="${bookname}" name="name">
    图书作者：<input type="text" th:value="${author}" name="author">
    图书类别：<input type="text" th:value="${category}" name="category">
    <input type="submit" value="搜索">
</form>
<table border="1">
    <tr>
        <th>选择</th>
        <th>编号</th>
        <th>书名</th>
        <th>价格</th>
        <th>类目</th>
        <th>库存</th>
        <th>图片</th>
        <th>说明</th>
        <th>作者</th>
        <th>已售</th>
        <th>操作</th>
    </tr>
    <form th:action="@{/book/del}" method="post" onsubmit="return validateForm()">
        <tr th:each="b:${page.records}">
            <td>
                <input type="checkbox" th:value="${b.id}" name="ids">
            </td>
            <td th:text="${b.id}"></td>
            <td th:text="${b.name}"></td>
            <td th:text="${b.price}"></td>
            <td th:text="${b.category}"></td>
            <td th:text="${b.pnum}"></td>
            <td th:text="${b.imgurl}"></td>
            <td th:text="${b.description}"></td>
            <td th:text="${b.author}"></td>
            <td th:text="${b.sales}"></td>
            <td>
                <a th:href="@{/book/add}">添加</a>&nbsp;&nbsp;<a th:href="@{'/book/getInfo?id='+${b.id}}">编辑</a>
                <!--    <a th:href="@{/book/getInfo(id=${b.id})}">编辑</a>       -->
            </td>
        </tr>
        <input type="submit" value="删除" onsubmit="return validateForm()">
    </form>
</table>

总的页数：<span th:text="${page.pages}"></span>
总的记录数：<span th:text="${page.total}"></span>
当前页的记录数:<span th:text="${page.size}"></span>
当前页：<span th:text="${page.current}"></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span th:if="${page.current>1}">
    <a th:href="@{/books/page(pageNum=${page.current -1})}">上一页</a>
</span>
<span th:each="p:${#numbers.sequence(1,page.pages)}">
    <a th:href="@{/books/page(pageNum=${p})}" th:text="${p}"></a>
</span>
<span th:if="${page.current<page.pages}">
    <a th:href="@{/books/page(pageNum=${page.current+1})}">下一页</a>
</span>
</body>
</html>